<ol class="form" <%= 'style="display: none;"' if columns.collapsed -%>>
  <% columns.each :for => @record do |column| -%>
  <% if is_subsection? column -%>
  <li class="sub-section">
    <h5><%= column.label %> (<%= link_to_visibility_toggle(:default_visible => !column.collapsed) -%>)</h5>
    <%= render :partial => 'form', :locals => { :columns => column } %>
  </li>
  <% elsif is_subform? column and !override_form_field?(column) -%>
  <li class="sub-form" id="<%= sub_form_id(:association => column.name) %>">
    <%= render :partial => form_partial_for_column(column), :locals => { :column => column } -%>
  </li>
  <% else -%>
  <li class="form-element <%= 'required' if column.required? %>">
    <%= render :partial => form_partial_for_column(column), :locals => { :column => column } -%>
  </li>
  <% end -%>
  <% end -%>
</ol>